{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "cb69db4c",
   "metadata": {},
   "source": [
    "# 本周学习内容\n",
    "\n",
    "> 1. 变量\n",
    ">> 1. 变量的定义与声明\n",
    ">> 2. 变量名的一般规则"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "457d135e",
   "metadata": {},
   "outputs": [],
   "source": [
    "## 变量学习\n",
    "网三_01_ID = \"220000001\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "825a8b98",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "网三_01_ID\n"
     ]
    }
   ],
   "source": [
    "print (\"网三_01_ID\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "69acc1de",
   "metadata": {},
   "outputs": [],
   "source": [
    "网三_01_name = \"小白\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "df133b8d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'220000001'"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网三_01_ID"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "70c81284",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 练习题： 判断今天是否有python课（time.local()) ,然后如果今天有python课，在判断现在是否是python课ing"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "5f27acab",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=9, tm_mday=7, tm_hour=20, tm_min=27, tm_sec=6, tm_wday=2, tm_yday=250, tm_isdst=0)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import time\n",
    "time.localtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "6f87f399",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2\n",
      "20\n",
      "36\n",
      "今天有python课，好开心呀\n",
      "python课ing，现在在第三节课\n"
     ]
    }
   ],
   "source": [
    "week_day = time.localtime().tm_wday\n",
    "print(week_day)\n",
    "\n",
    "time_hour = time.localtime().tm_hour\n",
    "print(time_hour)\n",
    "\n",
    "time_min = time.localtime().tm_min\n",
    "print(time_min)\n",
    "\n",
    "if week_day == 2:\n",
    "    print(\"今天有python课，好开心呀\")\n",
    "    if time_hour == 19:\n",
    "        print(\"python课ing\")\n",
    "    elif time_hour == 18 and time_min > 44:\n",
    "        print(\"python课ing，现在在第二节课\")\n",
    "    elif time_hour == 20 and time_min < 51:\n",
    "        print(\"python课ing，现在在第三节课\")\n",
    "    elif time_hour<18:\n",
    "        print(\"很不错\")\n",
    "else:\n",
    "    print(\"怎么还没到周三呢，哎，好着急\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1ae0bae8",
   "metadata": {},
   "source": [
    "# 循环遍历\n",
    "> 1. for循环\n",
    "> 2. range()方法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "b9c4199e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "2\n",
      "3\n"
     ]
    }
   ],
   "source": [
    "# 用例1\n",
    "for i in [1,2,3]:\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "8aeaf78c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "H\n",
      "i\n",
      "!\n"
     ]
    }
   ],
   "source": [
    "# 用例2\n",
    "for ch in \"Hi!\":\n",
    "    print(ch)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "91b3c9fe",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "1\n",
      "2\n",
      "3\n",
      "4\n"
     ]
    }
   ],
   "source": [
    "#用例3\n",
    "for num in range(5):\n",
    "    print(num)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "7341bbb4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "2\n",
      "3\n",
      "4\n"
     ]
    }
   ],
   "source": [
    "#用例3 拓展\n",
    "for num in range(1,5):\n",
    "    print(num)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "23dd7b9d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "3\n",
      "5\n",
      "7\n",
      "9\n"
     ]
    }
   ],
   "source": [
    "#扩展2\n",
    "for num in range(1,10,2):\n",
    "     print(num)\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "ed87d2fa",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "5\n",
      "9\n"
     ]
    }
   ],
   "source": [
    "#扩展3\n",
    "for num in range(1,10,4):\n",
    "     print(num)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f96f5a85",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
